/*
 * @Author: gitee 1758024667@qq.com
 * @Date: 2023-03-14 16:40:12
 * @LastEditors: gitee 1758024667@qq.com
 * @LastEditTime: 2023-04-06 22:07:47
 * @FilePath: \parking-lot-front-desk\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '@/views/layout/index.vue'
// 导入需要的组件
// import Home from '@/views/Home/Home.vue'
// import User from '@/views/User/User.vue'
// import Order from '@/views/Order/order.vue'
import Space from '@/views/Space/space.vue'
import detail from '@/views/Order/detail.vue'
import parkingLot from '@/views/ParkingLot/ParkingLot.vue'
import login from '@/views/login/index.vue'

// 把 VueRouter 安装为 Vue 的插件
Vue.use(VueRouter)

// 路由规则的数组
const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/Home',
    children: [{
      path: 'home',
      name: 'Home',
      component: () => import('@/views/Home/Home.vue'),
    },
    {
      path: 'user',
      name: 'User',
      component: () => import('@/views/User/User.vue'),
    },
    {
      path: 'space/:id',
      name: 'space',
      component: () => import('@/views/Space/space.vue'),
    },
    {
      path: 'order',
      name: 'Order',
      component: () => import('@/views/Order/order.vue'),
    },
  ]
  },
  // 定义首页的路由规则
  // { path: '/', component: Home },
  // 定义我的路由规则
  // { path: '/user', component: User },
  // 定义订单路由规则
  // { path: '/order', component: Order},
  { path: '/space/:id', component: Space},
  // 定义订单详情页链接
  { path: '/detail/:id', component: detail},
  // 停车场
  {path: '/parkingLot', component: parkingLot},
  // 登录
  {path: '/login', component: login}
]

// 创建路由实例对象
const router = new VueRouter({
  routes
})

export default router
